//
//  UIFont+Utility.m
//  DGUtilityKit
//
//  Created by Jinxiao on 12/3/13.
//  Copyright (c) 2013 debugeek. All rights reserved.
//

#import "UIFont+Utility.h"
#import <CoreText/CoreText.h>

@implementation UIFont (CustomFont)

+ (void)registerCustomFontWithFontPath:(NSString *)fontPath
{
    NSURL *fontUrl = [NSURL fileURLWithPath:fontPath];
    CGDataProviderRef fontDataProvider = CGDataProviderCreateWithURL((CFURLRef)fontUrl);
    CGFontRef font = CGFontCreateWithDataProvider(fontDataProvider);
    CGDataProviderRelease(fontDataProvider);
    CTFontManagerRegisterGraphicsFont(font, NULL);
    CGFontRelease(font);
}

@end